﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UnitTestingExample.Lib
{
    public class OrderProcesing
    {
        private int _maxOrder;
        public int MaximalOrder
        {
            get
            {
                return _maxOrder;
            }
        }

        private List<Order> _orders;
        public List<Order> Orders
        {
            get
            {
                return _orders;
            }
        }

        public OrderProcesing(int maxOrder)
        {
            _maxOrder = maxOrder;
            _orders = new List<Order>();
        }

        public void AddOrder(Order orderItem)
        {
            this.Orders.Add(orderItem);
            int tempCount = this.Orders.Count + 1;
            if (tempCount > _maxOrder)
            {
                throw new Exception("Can't exceeding max order");
            }
        }
    }
}
